<!DOCTYPE HTML>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="keywords" content="留言"/>
<meta http-equiv="description" content="留言"/>
<title>留言 - ${site.name} - Powered by JavaCMS</title>
<script src="${resSys}/jquery.js" type="text/javascript"></script>
<script src="${resSys}/front.js" type="text/javascript"></script>

<link type="text/css" rel="stylesheet" href="/${res}/css/index.css" />

<!--[if lt IE 9]> 
<script src="/${res}/js/html5shiv.min.js"></script>
<script src="/${res}/js/respond.min.js"></script>
<![endif]-->

<head>

<body>
[#include "../include/top.html"/]
[#include "../include/header.html"/] 
<div class="main container clearfix">
  <section class="message_w860">
    <h1>发表留言</h1>
    <form id="guestbookForm" action="${base}/guestbook.jspx" method="post">
    <div class="message_inf">
      <div class="line"></div>
      <p><span>类别</span>
      <select name="ctgId">
      [@cms_guestbook_ctg_list siteId=site.id]
      [#list tag_list as ctg]
      <option value="${ctg.id}">${ctg.name}</option>
      [/#list]
      [/@cms_guestbook_ctg_list]
      </select>
      </p>
      <p><span>邮箱</span><input type="text" name="email" class="message_email" maxlength="100" /><span>手机号</span><input type="text" name="phone" maxlength="50" class="message_phone" /><span style="width:auto;">QQ</span><input type="text" name="qq" class="message_qq" /></p>
      <div class="line"></div>
      <p><span>标题</span><input type="text" name="title" class="message_title" maxlength="255" /></p>
      <p><span>内容</span><textarea name="content" cols="55" rows="4" class="message_txt"></textarea></p>
      <p><span>验证码</span><input type="text" name="captcha" maxlength="20" vld="{required:true}" class="message_code" /><img id="guestbookCaptcha" src="${base}/captcha.svl" onclick="this.src='${base}/captcha.svl?d='+new Date()*1"></p>
      <input type="hidden" name="token" id="token" value="${token!}" />
      <p style="margin-top:30px; position:relative;"><input type="hidden" name="sessionId" id="sessionId" /><input type="submit" id="submit" class="message_btn" value="发表留言" /><!--<a class="tolist">查看留言列表</a>--></p>
    </div>
    </form>                                           
            <script type="text/javascript">
            $(function() {
            	$("#sessionId").val($.cookie("JSESSIONID"));
	        	$("#submit").click(function () {
	                var options = {
	                    url: 'guestbook.jspx',
	                    type: 'post',
	                    dataType: 'json',
	                    data: $("#guestbookForm").serialize(),
	                    success:  function (data) {
		                	if(data.status==0) {
			                    alert("留言成功");
			                    location.href=location.href;
			                } else if(data.status==1) {	
			                    alert("验证码错误");
			                    $("#guestbookCaptcha").click();
			                } else if(data.status==2) {	
			                    alert("留言尚未开启");
			                    $("#guestbookCaptcha").click();
			                } else if(data.status==3) {	
			                    alert("您需要登陆");
			                    $("#guestbookCaptcha").click();
			                }else if(data.status==4) {	
			                    alert("留言超过限制了!");
			                    $("#guestbookCaptcha").click();
			                }else if(data.status==10) {	
			                    alert("标题或者内容含有敏感词,不允许发表!");
			                    $("#guestbookCaptcha").click();
			                }
	                    }
	                };
	                $.ajax(options);
	                return false;
	            });
            });
            
            </script>
  </section>
  <section class="w310">
    <section class="tag clearfix">
      <div class="tag-nav"><h1><a>大家都在搜</a></h1></div>
      <div class="tagList">
        <div style="" class="cTag">
        [@cms_searchword_list word='' siteId='1' recommend='1' orderBy='4' count='11']
	        [#list tag_list as word]
		     <a href="${base}/search.jspx?q=${word.name!}">${word.name!}</a>
	        [/#list]
		[/@cms_searchword_list]
        </div>
      </div>
    </section>
    <section class="tag issue clearfix">
      <div class="tag-nav"><h1><a>热门话题</a></h1></div>
       [@cms_content_list typeId='2' count='5' orderBy='9' channelId='75' channelOption='1']
     [#list tag_list as a]
      <div class="item clearfix" [#if a_index<1]style="border-top:none;"[/#if]>
        <a href="${a.url}" target="_blank" class="img"><img src="${a.typeImg!}"></a>
        <h2><a href="${a.url}" target="_blank">[@text_cut s=a.title len='22' append='...' /]</a></h2>
        <div class="issue-comment">评论  (${a.contentCount.comments!})</div>
      </div>
     [/#list]
   [/@cms_content_list]
    </section>
  </section>
</div>
[#include "../include/footer.html"/]
[#include "../include/right-fixed.html"/]
</body>
</html>